const Body = require('./body');
const Header = require('./headers');
class Response extends Body {
  constructor(bodyInit, options) {
    super();
    this.status = options.status === undefined ? 200 : options.status;
    this.ok = this.status >= 200 && this.status < 300;
    this.statusText = 'statusText' in options ? options.statusText : 'OK';
    this.headers = new Header(options.headers);
    this.url = options.url || '';
    this._initBody(bodyInit);
  }
  clone() {
    return new Response(this.body, {
      status: this.status,
      statusText: this.statusText,
      headers: new Header(this.headers),
      url: this.url
    });
  }
}

module.exports = Response;
